<?php
class CustomValidator extends Validator {

	public static $messages = array(
			'required'		=> ':attribute 不能为空',
			'alpha_dash'	=> '仅允许字母、数字、破折号（-）以及底线（_）',
			'exists' 		=> '该 :attribute 不存在',
			'unique'		=> '已存在'
		);

	public static $attributes = array(
			'categoryName'	=> '栏目名',
			'modelId'		=> '模型id',
			'categoryId' 	=> '栏目id',
		);

	public static function validateInput($data, $rules) {
		$validator = Validator::make($data, $rules, self::$messages, self::$attributes);
		if($validator->fails()){
			return $validator->messages()->first();
		}
    }
    
}